package gestionSimpleATester;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class DepositOperationTest {

	DepositOperation dop;
	
	@Before
	public void setUp() throws Exception {
		dop = new DepositOperation(0);
	}

	@After
	public void tearDown() throws Exception {
		dop = null;
	}

	/**
	 * BUG FOUND with the test below
	 */
	
	@Test
	public void testGetOperationType() {
		assertEquals("Deposit",dop.getOperationType());
	}

	@Test
	public void testDepositOperation() {
		try{
			DepositOperation x = new DepositOperation(-10);
			fail();
		}
		catch(Exception e){}
		
		try{
			DepositOperation x = new DepositOperation(0);
		}
		catch(Exception e){fail();}
		
		try{
			DepositOperation x = new DepositOperation(100);
		}
		catch(Exception e){fail();}
	}

	@Test
	public void testGetAmount() {
		dop.setAmount(0);
		assertEquals(0, dop.getAmount());
		dop.setAmount(-10);
		assertEquals(-10, dop.getAmount());
		dop.setAmount(1);
		assertEquals(1, dop.getAmount());
	}

	@Test
	public void testSetAmount() {
		dop.setAmount(0);
		assertEquals(0, dop.getAmount());
		dop.setAmount(-10);
		assertEquals(-10, dop.getAmount());
		dop.setAmount(1);
		assertEquals(1, dop.getAmount());
	}

	@Test
	public void testOperation() {
		
	}

}
